$(document).ready(function(){				   
	
	/* tabs */
	$("#tabs").tabs();

	$("#link-emp-info").click(function(){
		$('.box-title').html('Employee 201');		
		$('.hideable').hide(0);
		$('#employee-info').fadeIn();
	});
	
	$("#link-emp-dtr").click(function(){
		$('.box-title').html('Daily Time Record');		
		$('.hideable').hide(0);
		$('#employee-dtr').fadeIn();
	});
	
	$("#link-emp-leave").click(function(){
		$('.box-title').html('Leave Applications');		
		$('.hideable').hide(0);
		$('#employee-leave').fadeIn();
	});
	
	$("#link-emp-ot").click(function(){
		$('.box-title').html('Overtime/Undertime Applications');		
		$('.hideable').hide(0);
		$('#employee-ot').fadeIn();
	});
	
	$("#link-emp-contributions").click(function(){
		$('.box-title').html('Contributions');		
		$('.hideable').hide(0);
		$('#employee-contributions').fadeIn();
	});
	
	$("#link-emp-deductions").click(function(){
		$('.box-title').html('Other Deductions');		
		$('.hideable').hide(0);
		$('#employee-deductions').fadeIn();
	});
		
	$("#link-emp-payslip").click(function(){
		$('.box-title').html('Payslip');		
		$('.hideable').hide(0);
		$('#employee-payslip').fadeIn();
	});
	
	$("#link-view-leaves").click(function(){
		$("#table-leaves").toggle('slow');
	});
	
	$("#link-view-ot-undertime").click(function(){
		$("#table-ot-undertime").toggle('slow');
	});
	
	$("#link-view-sss-contributions").click(function(){
		$("#table-sss-contributions").toggle('slow');
	});
	
	$("#link-view-pagibig-contributions").click(function(){
		$("#table-pagibig-contributions").toggle('slow');
	});
	
	$("#link-view-philhealth-contributions").click(function(){
		$("#table-philhealth-contributions").toggle('slow');
	});
	
	$("#link-view-deductions").click(function(){
		$("#table-deductions").toggle('slow');
	});
	
	$("#link-view-payslips").click(function(){
		$("#table-payslips").toggle('slow');
	});
	
	$("#link-personal-details").click(function(){
		$("#personal-details").toggle('slow');
	});
	
	$("#link-education").click(function(){
		$("#education").toggle('slow');
	});
	
	$("#link-work-experience").click(function(){
		$("#work-experience").toggle('slow');
	});
	
	$("#link-hr-reference").click(function(){
		$("#hr-reference").toggle('slow');
	});
	
	$("#link-payroll-reference").click(function(){
		$("#payroll-reference").toggle('slow');
	});
	
	$("#link-view-all-allowance").click(function(){
		$("#all-allowances").toggle('slow');
	});
	
	$("#link-view-all-increase").click(function(){
		$("#all-increases").toggle('slow');
	});
	
	$("#deduction-others").click(function(){
		$("#misc-details").show('slow');
	});
	
	$("#select-deduction").change(function(){
		$selected = $("#select-deduction option:selected").val();
		if($selected == 'others')
		{
			$("#deduction-details").show(0);
		}
		else
		{
			$("#deduction-details").hide(0);
		}
	});
	
	$("#report-filters").change(function(){
		$selected = $("#report-filters option:selected").text();
		if($selected == 'Employee 201 - HR')
		{
			$(".report-hideable").hide(0);
			$("#report-payroll").slideDown('slow', 
		    	function(){
					$(".report-hidden-table").hide(0);
					$("#report-title").html('Employee 201 - HR');
					$("#report-subtitle").html('Employee 201 - HR');
					$("#report-table-payroll").show(0);
				});
		}
		else if($selected == 'Employee 201 - Payroll')
		{
			$(".report-hideable").hide(0);
			$("#report-payroll").slideDown('slow', 
		    	function(){
					$(".report-hidden-table").hide(0);
					$("#report-title").html('Employee 201 - Payroll');
					$("#report-subtitle").html('Basic Salary, Overtime Rates, and Holiday Rates');
					$("#report-table-payroll").show(0);
					$("#entry_list").show(0);
				});
		}
		else if($selected == 'Leave Applications')
		{
			$(".report-hideable").hide(0);
			$("#report-leave").slideDown('slow', 
		    	function(){
					$(".report-hidden-table").hide(0);
					$("#report-title").html('Leave Applications');
					$("#report-subtitle").html('December 1, 2010 to December 30, 2010');
					$("#report-table-leaves").show(0);
				});
		}
		else if($selected == 'Overtime Applications')
		{
			$(".report-hideable").hide(0);
			$("#report-overtime").slideDown('slow', 
		    	function(){
					$(".report-hidden-table").hide(0);
					$("#report-title").html('Overtime Applications');
					$("#report-subtitle").html('December 1, 2010 to December 30, 2010');
					$("#report-table-overtime").show(0);
				});
		}
		else if($selected == 'Undertime Applications')
		{
			$(".report-hideable").hide(0);
			$("#report-undertime").slideDown('slow', 
		    	function(){
					$(".report-hidden-table").hide(0);
					$("#report-title").html('Undertime Applications');
					$("#report-subtitle").html('December 1, 2010 to December 30, 2010');
					$("#report-table-undertime").show(0);
				});
		}
		else if($selected == 'Contributions')
		{
			$(".report-hideable").hide(0);
			$("#report-contributions").slideDown('slow', 
		    	function(){
					$(".report-hidden-table").hide(0);
					$("#report-title").html('Total Contributions');
					$("#report-subtitle").html('SSS, Pag-ibig, and Phil Health');
					$("#report-table-contributions").show(0);
				});
		}
		else if($selected == 'Other Deductions')
		{
			$(".report-hideable").hide(0);
			$("#report-deductions").slideDown('slow', 
		    	function(){
					$(".report-hidden-table").hide(0);
					$("#report-title").html('Deductions : SSS Loan');
					$("#report-subtitle").html('December 1, 2010 to December 30, 2010');
					$("#report-table-deductions").show(0);
				});
		}
		else if($selected == 'Print Payslips')
		{
			$(".report-hideable").hide(0);
			$("#report-payslips").slideDown('slow', 
		    	function(){
					$(".report-hidden-table").hide(0);
					$("#report-title").html('Printing payslips for December 1 to December 15, 2010. <a href="#">Continue</a>');
					$("#report-subtitle").html('');
					$("#entry_list").hide(0);
				});
		}
	});
	
	$(".payroll-options").change(function(){
		$selected = $("input:radio[name='payroll-options']:checked").val();
		
		if($selected == 'employee_rates')
		{
			$(".increase-row-hidden").hide(0);
			$(".emp-rate-row-hidden").slideDown(0);
		}
		else
		{
			$(".emp-rate-row-hidden").hide(0);
			$(".increase-row-hidden").show(0);
		}
	});
		
});